<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@taglib uri="/struts-tags" prefix="s" %>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title>分类列表</title>
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0"> 
	<s:head/>   
	<link rel="stylesheet" href="../theme1/css/reset.css" type="text/css"/>
	<link rel="stylesheet" href="../theme1/css/screen.css" type="text/css"/>
	<link rel="stylesheet" href="../theme1/css/screen-common.css" type="text/css"/>	
	<script type="text/javascript" src="../js/jquery.js"></script>	
	<script type="text/javascript" src="../js/jquery.ui.js"></script>	
	<script type="text/javascript" src="../theme1/js1/script.js"></script>   
  </head>
  
  <body>
  <div class="page wrap" >
  <!-- menu bar -->
  <div class="menubar clear" >
	  <ul class="menus clear">
		  <li><a href="Category_edit.action" >添加分类</a></li>
	  </ul>
  </div>
  <div class="content-box">
   <div class="box-header clear">					
			<h2>分类列表</h2>
    </div>
    <form>
    <div class="box-body clear"> 
    <s:actionerror/>
    <s:actionmessage/>   
   	<table>
	  	<thead>
	  	<tr>
	  		<th><input type="checkbox" class="checkbox select-all"></th>
	  		<th>名称</th>
	  		<th>操作</th>	
	  	</tr>
	  	</thead>
	  	<tbody>
	  	<s:iterator value="categories" var="a">
	  	<tr>
	  		<td><input type="checkbox" class="checkbox" value="<s:property value="#a.getId()"/>"></td>
	  		<td>
	  		<s:if test="#a.getParentId() == -1">
	  			<a href="Category_list.action?category.parentId=<s:property value="#a.getId()"/>"><s:property value="#a.getCategoryName()"/></a>	
	  		</s:if>
	  		<s:else>
	  			<s:property value="#a.getCategoryName()"/>
	  		</s:else>	
	  		</td>	
	  		<td>
	  		<a class="oprlink" href="Category_delete.action?category.id=<s:property value="#a.getId()"/>" >
	  		<img title="删除" alt="" class="icon16 fl-space2" src="../theme1/images/ico_delete_16.png"/>
	  		</a>
	  			
	  		<a class="oprlink" href="Category_edit.action?category.id=<s:property value="#a.getId()"/>">
	  			<img title="编辑" alt="" class="icon16 fl-space2" src="../theme1/images/ico_edit_16.png"/>
	  		</a>
	  		</td>
	  	</tr>
		</s:iterator>
		</tbody>
  	</table>
    
  	<pg:pager url="Category_list.action" items="${pageModel.total}" 
    		export="currentPageNumber=pageNumber" maxPageItems="3" maxIndexPages="5">  
     
	     <pg:first>  
	         <a href="${pageUrl}">首页</a>  
	     </pg:first>  
	     <pg:prev>  
	         <a href="${pageUrl }">上一页</a>  
	     </pg:prev>  
	     <pg:pages>  
	    
	         <c:choose>  
	             <c:when test="${currentPageNumber eq pageNumber}">  
	                 <font color="red">${pageNumber }</font>  
	             </c:when>  
	             <c:otherwise>  
	                 <a href="${pageUrl }">${pageNumber }</a>  
	             </c:otherwise>  
	         </c:choose>
	         
	          
	     </pg:pages>  
	     <pg:next>  
	         <a href="${pageUrl }">下一页</a>  
	     </pg:next>  
	     <pg:last>  
	         <a href="${pageUrl }">尾页</a>  
	     </pg:last>  
 	</pg:pager>
    </div>
    </form>
  </div>
  </div>    
  </body>
</html>
